import { parseTime } from ".";

/**
 * 数字与书籍类型的对应关系，因为后端传递的书籍类型仅是数字而已
 */
export const bookTypes = {
  1: "爱情情感",
  2: "玄幻惊悚",
  3: "古言穿越",
  4: "校园成长",
  5: "偶像娱乐",
  6: "爆笑无厘头",
  21: "随笔",
  22: "文学作品集",
  23: "诗词歌赋",
  24: "文学评论与鉴赏",
  25: "文学理论",
  26: "戏剧",
  27: "民间文学",
  28: "纪实文学",
  31: "侦探/悬疑/推理",
  32: "都市情感",
  33: "社会生活",
  34: "作品集",
  35: "历史",
  36: "中国近当代小说",
  37: "中国古典小说",
  38: "职场",
  39: "影视小说",
};

export function transBookType(bookList) {
  return bookList.map((_) => {
    const book = { ..._ };
    // 转换书籍类型
    book.bookTypeStr = bookTypes[_.bookType];
    return book;
  });
}
